package importPool;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Vector;


public class Master_table implements TableName 
{
	private String[] str = null;
	private Vector<Object> indexVector=new Vector<Object>();
	
	public void initialize(String inputpath, Vector<Object> JSelectedcheck)
	{
		
		RandomAccessFile file;
		try 
		{
			file = new RandomAccessFile(inputpath,"rws");
			Vector<Object> itemVector=new Vector<Object>();
			
			String heading=" ";
			String itemName=" ";
			
			try 
			{
				heading=file.readLine();
				System.out.println("Heading ========="+heading);
				str=heading.split("\t");
				for(int i=0;i<JSelectedcheck.size();i++)
				{
					itemName=(String) JSelectedcheck.get(i);
					System.out.println("itemName"+itemName);
					for(int j=0;j<str.length;j++)
					{
						if(str[j].equals(itemName))
						{
							indexVector.add(j);
						}
					}
					
					itemVector.add(itemName);
				}
				System.out.println("itemVector    "+itemVector);
				System.out.println("IndexVector"+indexVector);
			
			}
			catch (IOException e1) 
			{
				e1.printStackTrace();
			}
		}
		catch (FileNotFoundException e)
		{
			
			e.printStackTrace();
		}		
		
		String responsePath = ImportFilePath.RATERESPONSEPATH;
		RegisterMaster reg = new RegisterMaster(inputpath,responsePath);		
		reg.registerItem(indexVector);

		//System.out.println("Result :: "+reg.Register(indexVector));		
		
	}
	

	
}
 
